<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import=" java.util.List"%>
<%@ page import=" com.demo.entity.Orders"%>
<%@ page import=" com.demo.entity.CartInfoList"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>订单查询-我的订单</title>
<script type="text/javascript">
    function check() {
         alert("已支付，请勿重复支付 ! ");
         return false;
    }
    function checkUnPay() {
        alert("已支付，无法撤销 ! ");
        return false;
    }
</script>
</head>
<body>
<center>
    <fieldset>
        <legend style="color: #00f"> <h3>我的订单</h3> </legend>
        <table border="1">
            <tr>
            <!--  
                <th>商品*数量</th>
                <th>商品单价</th>-->
                <th>订单费用</th>
                <th>收件人</th>
                <th>收件号码</th>
                <th>收件地址</th>
                <th>下单时间</th>
                <th>支付状态</th>
                <th>支付操作</th>
                <th>撤销操作</th>
            </tr>
            <%
                CartInfoList orderProducts =  (CartInfoList)session.getAttribute("orderProductsInfo");
                List<Orders> ordersList = (ArrayList<Orders>) session.getAttribute("ordersInfo");
                for (Orders orders : ordersList) {
            %>
            <tr>
<%--
                <%if(orderProducts != null && (orderProducts.getP_buynum()*orderProducts.getP_price()==orders.getMoney())){ %>
                <th><%=orderProducts.getP_name()%>  *<%=orderProducts.getP_buynum()%></th>
                <th><%=orderProducts.getP_price()%></th>
                <%}else{ %>
                <th> </th>
                <th> </th>
                <%} %>
--%>
                <th><%=orders.getMoney()%></th>
                <th><%=orders.getReceiverName()%></th>
                <th><%=orders.getReceiverPhone()%></th>
                <th><%=orders.getReceiverAddress()%></th>
                <th><%=orders.getOrdertime()%></th>
                
                <%int stateNum = orders.getPaystate();
                      if(stateNum == 1){ %>
                <th><font style="color: #00f">已支付</font></th>
                <th><a href="#"  onclick="return check();">支付</a></th>
                <th><a href="#"  onclick="return checkUnPay();">撤销</a></th>
                <%} else if(stateNum == 0){%>
                <th><font style="color: #f00">未支付</font></th>
                <th><a href="updatePayOrdersById/<%=orders.getId() %>" >支付</a></th>
                <th><a href="deleteUnPayOrdersById/<%=orders.getId() %>"  >撤销</a></th>
                <%} %>
                
            </tr>
            <%
                 } 
            %>
            <tr><th colspan="10" style="color: #00f" bgcolor="#00f"  height="2px"></th></tr>
            <tr><th colspan="10" align="right"><a href="product_list_page_action">继续购物</a>
                                                                             <a href="cart_list_action">查看购物车</a></th></tr>
        </table>
    </fieldset>
</center>
</body>
</html>